import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
// 创建仓库
const store = new Vuex.Store({
  // 严格模式
  strict: true,
  state: {
    title: 'title',
    count: 100
  },
  mutations: {
    // 所有mutation函数，第一个参数都是state
    addCount (state, n) {
      state.count += n
    },
    cTietl (state, obj) {
      state.title = obj.oldName
    },
    countSub (state, n) {
      state.count -= n
    },
    changeHandle (state, s) {
      state.count = s
    },
    cHandle (state, i) {
      state.title = i
    }
    /*     addCountt (state) {
      state.count += 5
    } */
  }
})

// 导出
export default store
